Equality Pollution
^^^^^
**Definition:**
* The code that is put into production contains logic that should be exercised only during tests… A system that behaves one way in the test lab and an entirely different way in production is a recipe for disaster!
**Code Example:**
.. code-block:: java
///
/// Verifies that two objects are equal, using a default comparer.
///
/// The type of the objects to be compared
/// The expected value
/// The value to be compared against
/// Thrown when the objects are not equal
public static void Equal(T expected, T actual)
{
Equal(expected, actual, GetEqualityComparer());
}
**References:**
.. admonition:: Quality attributes
* :octicon:`file-code;1em` - Code Example
* :octicon:`comment-discussion;1em` - Cause and Effect
* :octicon:`graph;1em` - Frequency
* :octicon:`sync;1em` - Refactoring
* `How to Compare Object Instances in your Unit Tests Quickly and Easily `_ :octicon:`file-code;1em` :octicon:`comment-discussion;1em` :octicon:`sync;1em`
* `xUnit test patterns: Refactoring test code `_ :octicon:`comment-discussion;1em` :octicon:`sync;1em`